package level.editor.main;

import level.editor.command.Command;
import level.editor.mediator.Mediator;
import level.editor.mediator.Module;
import level.editor.window.HasView;
import level.editor.window.Window;

/*
 * Module that handles interaction between the level editor proper and the other
 * parts of the editor. LevelModule is responsible for passing arguments from
 * the level editing area to StateModule in the case of state changes. It
 * communicates with the ToolModule and AdvancedModule to fulfill edit orders.
 * 
 * Its executeCommand() will consist of calls to the methods of LevelView to
 * change the output.
 */

public class LevelModule extends Module implements HasView
{
	private LevelView view;

	public LevelModule(Mediator mediator)
	{
		super(mediator, "LevelModule");
		view = null;
	}

	@Override
	public void establishView(Window window)
	{
		LevelView view = new LevelView();
		view.registerModule(this);
		view.init(window);
		this.view = view;
	}

	@Override
	public void pushDownCommand(Command command)
	{
		if (view != null && command != null)
			view.pushDownCommand(command);
	}

}
